<%@ page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="html" uri="http://struts.apache.org/tags-html"%>
<%@taglib prefix="bean" uri="http://struts.apache.org/tags-bean"%>
<%@taglib prefix="logic" uri="http://struts.apache.org/tags-logic" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<h3><bean:message key="user.list.title"/></h3>
<html:form action="/userListing" method="POST">

	<c:forEach var="user" items="${users}">
		<a href="userDelete.do?id=${user.id}">
			<button type="button" class="btn btn-xs btn-danger">
				<bean:message key="user.list.delete"/>
			</button>
		</a>
		<c:if test="${!user.admin}">
			<a href="changeRole.do?id=${user.id}&role=true">
				<button type="button" class="btn btn-xs btn-primary">
					<bean:message key="user.role.change.admin"/>
			</button></a>
		</c:if>
		<c:if test="${user.admin}">	
			<a href="changeRole.do?id=${user.id}&role=false">
				<button type="button" class="btn btn-xs btn-warning">
					<bean:message key="user.role.change.user"/>
			</button></a>
		</c:if>
		${user.username} - ${user.name} ${user.surname}
		<br/>
	</c:forEach>     
</html:form>